package pikes.html.xhtml;

import pikes.xml.XMLTag;

/**
 * <code>dir</code> attribute, see <a href="http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir"><code>dir</code>
 * attribute</a> in HTML specification.
 * @author Peter Bona
 * @see <a href="http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir">The <code>dir</code> attribute in HTML
 * specification</a>
 */
public abstract class Direction implements TagDecorator {

	public static Direction LEFT_TO_RIGHT = new Direction() {

		@Override
		protected CharSequence getValue() {
			return "ltr";
		}
	};

	public static Direction RIGHT_TO_LEFT = new Direction() {

		@Override
		protected CharSequence getValue() {
			return "rtl";
		}
	};

	public void decorateTag(XMLTag tag) {
		tag.addAttribute("dir", getValue());
	}

	abstract protected CharSequence getValue();

}
